/* 
 * File:   type_gui.h
 * Author: tasx
 *
 * Created on 27 settembre 2011, 14.24
 */

#ifndef TYPE_GUI_H
#define	TYPE_GUI_H

#ifdef	__cplusplus
extern "C" {
#endif

#include <glib.h>
#include <SDL/SDL.h>
    
#include "../util/type.h"
    
#define GUI_BUTTON      1
#define GUI_TEXTBOX     2
#define GUI_LABEL       3
#define GUI_NOTEBOOK    4
    
#define GUI_POSITION_LEFT       1
#define GUI_POSITION_HMIDDLE    2
#define GUI_POSITION_RIGHT      3
#define GUI_POSITION_TOP        4
#define GUI_POSITION_VMIDDLE    5
#define GUI_POSITION_BOTTOM     6
    
#define GUI_NOTEBOOK_TAB_WIDTH  100
#define GUI_NOTEBOOK_TAB_HEIGHT 40
#define GUI_NOTEBOOK_TAB_PADDING_N_S 5
#define GUI_NOTEBOOK_TAB_PADDING_W_E 10
#define GUI_NOTEBOOK_TAB_SPACING 5

    typedef struct _graphics_element graphic_element;
    typedef struct _button button;
    typedef struct _textbox textbox;
    typedef struct _label label;
    typedef struct _notebook notebook;
    typedef struct _notebook_page notebook_page;
    typedef struct _notebook_page_tab notebook_page_tab;
    
    struct _graphics_element {
        SDL_Surface *graphic;
        int posx;
        int posy;
        int type;
        gboolean redraw;
        gboolean focused;
        gboolean visible;
    };
    
    struct _button {
        graphic_element ge;
        GString *text;
        SDL_Surface *text_render;
        gboolean(*click)(main_obj*, button*);
        gboolean(*update)(main_obj*, button*);
        gboolean(*paint)(main_obj*, button*);
        gboolean(*direct_paint)(main_obj*, button*, graphic_element*);
        gboolean(*mouse_enter)();
        gboolean(*mouse_exit)();
    };

    struct _textbox {
        graphic_element ge;
        GString *text;
        GString *ptext;
        int posx;
        int posy;
        int mode;
        gboolean(*click)(main_obj*, textbox*);
        gboolean(*enter)();
        gboolean(*paint)(main_obj*, textbox*);
        gboolean(*update)(main_obj*, textbox*);
    };
    
    struct _label {
        graphic_element ge;
        GString *text;
        gboolean(*update)(main_obj*, label*);
        gboolean(*paint)(main_obj*, label*);
    };
    
    struct _notebook_page_tab {
        gint x;
        gint y;
        gint w;
        gint h;
    };
    
    struct _notebook_page {
        GString *title;
        GList *elements;
        notebook_page_tab *npt;
        SDL_Surface *title_renderd;
    };
    
    struct _notebook {
        graphic_element ge;
        SDL_Surface *default_background;
        SDL_Surface *pre_buf_tab;
        gint current_page;
        gint n_page;
        gint tab_width;
        gint tab_height;
        gint tab_padding;
        GList *notebook_pages;
        gboolean(*update)(main_obj*, notebook*);
        gboolean(*paint)(main_obj*, notebook*);
    };
    

#ifdef	__cplusplus
}
#endif

#endif	/* TYPE_GUI_H */

